import request from '@/utils/request'
import qs from 'qs'
const baseUrl = import.meta.env.VITE_APP_BASE_JKPG
const apiHealth = {
  getHealthDeepInfo: function (id) {
    return request({
      url: baseUrl + '/healthSituation/getHealthDeepInfo/' + id,
      method: 'get'
    })
  },
  getIndexCurveData: function (id) {
    return request({
      url: baseUrl + '/healthSituation/getIndexCurveData/' + id,
      method: 'get'
    })
  },
  // 子节点数
  getChildrenNodeTree: function (id) {
    return request({
      url: baseUrl + '/nodeTree/getChildrenNodeTree/' + id,
      method: 'get'
    })
  },
  getTimeAxisData: function (id, eDate = '', sDate = '') {
    const data = { id, eDate, sDate }
    return request({
      url: baseUrl + `/healthSituation/timeAxisData`,
      method: 'get',
      params: data
    })
  },
  evaluation: function (data) {
    return request({
      url: baseUrl + `/healthSituation/evaluation`,
      method: 'post',
      data: qs.parse(data),
      title: '评估计算中...'
    })
  },
  // 生成健康报告
  getHealthReport: function (nodeId) {
    return request({
      url: baseUrl + '/healthSituation/generateHealthReport?nodeId=' + nodeId,
      method: 'get'
    })
  }
}
export { apiHealth }
